import { defineStore } from 'pinia';
import defaultSettings from '@/global/settings.json';
import { AppState } from './types';

const useAppStore = defineStore('app', {
  state: (): AppState => ({ ...defaultSettings }),

  getters: {
    appCurrentSetting(state: AppState): AppState {
      return { ...state };
    },
  },
  actions: {
    // 更新app设置
    updateSettings(partial: Partial<AppState>) {
      this.$patch(partial);
    },

  },
});

export default useAppStore;
